﻿namespace OverStore.Runtime.ObjectRepository.Depot.IdentifierGenerator
{
    /// <summary>
    /// Provide methods for generate identifiers for new instances.
    /// </summary>
    /// <typeparam name="TInstance">The type of the instance.</typeparam>
    /// <typeparam name="TIdentifier">The type of the identifier.</typeparam>
    public interface IIdentifierGenerator<TInstance, TIdentifier> : IRuntimeComponent
        where TInstance : class
    {
        /// <summary>
        /// Obtain next identifier for specified instance.
        /// </summary>
        /// <param name="instance">The instance to obtain identifier for it.</param>
        /// <returns>The next result of identifier for specified instance.</returns>
        /// <exception cref="T:OverStore.Runtime.Repository.Depot.DepotException">The error occured due generating identifier.</exception>
        TIdentifier NextIdentifier(TInstance instance);
    }
}
